//
//  PointService.swift
//  ezyform
//
//  Created by MoennigQ on 30/12/19.
//  Copyright © 2019 Client.Solution Pty Ltd. All rights reserved.
//

import UIKit

class PointService: BaseService {
    //当前积分信息
    func getCurrentTotalPoints(){
        
        let alRequest = ALRequest.init(mainURL: APIConfig.getRequestAPIForV2(APIConfig.CurrentTotalPointsAPI), method: .get, headers: RequestConstant.AuthTokenParam, paramDict: nil, successBlock: {(obj, _) -> Void in
            
            self.returnBlock(obj, nil)
            
        }) {(code, obj) -> Void in
            self.errorBlock?(code, obj)
        }
        alRequest.startRequest()
    }
    //历史积分信息
    func getPointsList(_ page: String){
        let url : String = APIConfig.getRequestAPIForV2(APIConfig.PointsListAPI) + "?page=" + page
        let alRequest = ALRequest.init(mainURL: url, method: .get, headers: RequestConstant.AuthTokenParam, paramDict: nil, successBlock: {(result, otherInfo) -> Void in
            
               self.returnBlock(result,otherInfo)
            
        }) {(code, obj) -> Void in
            self.errorBlock?(code, obj)
        }
        alRequest.startRequest()
    }
    //获取会员积分的说明信息
    func getPointDescription(){
        
        let alRequest = ALRequest.init(mainURL: APIConfig.getRequestAPIForV2(APIConfig.PointDescriptionAPI), method: .get, headers: RequestConstant.AuthTokenParam, paramDict: nil, successBlock: {(obj, _) -> Void in
            
            self.returnBlock(obj,nil)
            
        }) {(code, obj) -> Void in
            self.errorBlock?(code, obj)
        }
        alRequest.startRequest()
    }
}
